package main

import "fmt"

// 交换变量  n1,n2 = n2,n1
func main() {

	var a int = 5
	var b int = 10

	a, b = b, a
	fmt.Printf("00father=%d  04fox=%d\n", a, b)

	a = a + b //  00father = 00father + 04fox
	b = a - b //  04fox = (00father + 04fox) -04fox    =>04fox=00father
	a = a - b //  00father = (00father + 04fox) -00father    由于b=00father =>  00father = (00father + 04fox) -04fox  =>00father=04fox
	fmt.Printf("00father=%d  04fox=%d\n", a, b)
	var x1 = 10
	var x2 = 20
	var x3 = 30
	var x4 = 40

	x1, x2, x3, x4 = x4, x3, x2, x1
	fmt.Printf("x4=%d  x3=%d  x2=%d  x1=%d\n", x4, x3, x2, x1)
}
